using System;
using System.Collections.Generic;
using System.Text;

namespace WGT
{
    public partial class Dialog
    {
        public bool Grid<T>(pos p, KeyValuePair<string, Func<T, string>>[] meta, Func<List<T>> get)
        {
            var items = get();
            
            var html = new StringBuilder("<table>");
            
            for (int i = 0; i < items.Count; i++)
            {
                html.Append("<tr>");
                
                for (int j = 0; j < meta.Length; j++)
                {
                    html.Append("<td>");
                    html.Append(meta[j].Value(items[i]));
                    html.Append("</td>");
                }

                html.Append("</tr>");
            }
            
            html.Append("</table>");

            return false;
        }
    }
}